<?php
// +----------------------------------------------------------------------
// | snake
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2022 http://baiyf.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: NickBai <1902822973@qq.com>
// +----------------------------------------------------------------------
namespace app\common\model;

use think\Model;

class ActivitySponsor extends Model
{

    public static $status = [
        0 => '关闭',
        1 => '开启'
    ];

    public function allSponsor($map, $offset, $limit)
    {
        $map['is_del'] = 0;
        return $this->where($map)->limit($offset,$limit)->select();
    }

    public function add($data)
    {
        $data['create_time'] = time();
        return $this->insert($data);
    }

    public function edit($data)
    {
        return $this->update($data);
    }

    public function del($id)
    {
        $data = [
            'id' => $id,
            'is_del' => time(),
        ];
        return $this->update($data);
    }
}
